package com.study.www.demo.config;

import com.study.www.demo.Application;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.boot.web.servlet.ServletComponentScan;

import javax.annotation.PostConstruct;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;

/**
 * @author : Administrator.zhuyanpeng
 * @date : 2019/11/15 - 16:35
 */
@Slf4j
@WebListener
@ServletComponentScan("com.study.www.demo.web")
public class DemoRequestListener implements ServletRequestListener {

    public DemoRequestListener() {
        log.warn("DemoRequestListener 的 constructor ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }

    @PostConstruct
    public void postConstruct(){
        log.warn("DemoRequestListener 的 postConstruct ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }

    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        log.warn("DemoRequestListener 的 requestInitialized ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }

    @Override
    public void requestDestroyed(ServletRequestEvent sre) {
        log.warn("DemoRequestListener 的 requestDestroyed ;启动时间=>"+new DateTime().toString(Application.DATEFORMAT));
    }
}
